package com.lj.demo.springbootshirojwt.controller;

import com.lj.demo.springbootshirojwt.entity.ResponseResult;
import com.lj.demo.springbootshirojwt.service.IResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Title: 资源controller
 * Description:
 * Date: 2019年06月27日 8:50
 *
 * @author lvjie@hiynn.com
 * @version 1.0
 * Significant Modify：
 * Date                  Author                 Content
 * =================================================================
 * 2019年06月27日         lvjie@hiynn.com         创建文件,实现基本功能
 * =================================================================
 */
@RestController
@RequestMapping("/resource")
public class ResourceController {

    @Autowired
    private IResourceService resourceService;

    /**
     * 获取资源列表
     * @return
     */
    @RequestMapping(value = "/resources",method = RequestMethod.GET)
    public ResponseResult listResources(){
        List<Map<String,Object>> resources = resourceService.listResources();
        return ResponseResult.success(resources);
    }

    /**
     * 修改资源
     * @return
     */
    @RequestMapping(value = "/updateResource",method = RequestMethod.PATCH)
    public ResponseResult updateResource(){
        resourceService.updateResource();
        return ResponseResult.success("success");
    }
}
